home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group99a.txt / 000190_icon-group-sender _Wed Sep 8 07:49:48 1999.msg < prev    next >
Internet Message Format  |  2000-09-20  |  3KB

  1. Return-Path: <icon-group-sender>
  2. Received: (from root@localhost)
  3.     by baskerville.CS.Arizona.EDU (8.9.1a/8.9.1) id HAA28346
  4.     for icon-group-addresses; Wed, 8 Sep 1999 07:49:39 -0700 (MST)
  5. Message-Id: <199909081449.HAA28346@baskerville.CS.Arizona.EDU>
  6. From: "Frank Lhota" <lhotaf@lexma.meitech.com>
  7. To: "Richard A. O'Keefe" <ok@hermes.otago.ac.nz>,
  8.         <icon-group@optima.CS.Arizona.EDU>, <memphis@macconnect.com>
  9. Subject: Re: Is open(..,"b") broken in MPW Icon 9.0?
  10. Date: Wed, 8 Sep 1999 09:38:42 -0400
  11. X-Priority: 3
  12. X-MSMail-Priority: Normal
  13. X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
  14. Errors-To: icon-group-errors@optima.CS.Arizona.EDU
  15. Status: RO
  16.  
  17. Armed with this information, I would try this in the [@fsys.05] section for
  18. MACINTOSH:
  19.  
  20. #if MACINTOSH
  21.       if ((status & (Fs_Read|Fs_Write)) == (Fs_Read|Fs_Write)) {
  22.          mode[1] = '+';
  23.          if ((status & Fs_Untrans) != 0) mode[2] = 'b';
  24.          }
  25.       else if ((status & Fs_Untrans) != 0) mode[1] = 'b';
  26. #endif     /* MACINTOSH */
  27.  
  28. Please let me know if this fixes the problem.
  29.  
  30. While we're on the subject, it might be worth our while to revisit the
  31. [@fsys.05] section of code. Quite conceivably, we could cut this section out
  32. entirely The raison d'jtre for this section is that in Vanilla C, the form
  33. of the fopen mode parameter was platform specific. The only mode parameters
  34. spelled out in the original K&R book were "r", "w", and "a", although many
  35. pre-ANSI compilers supported more options.
  36.  
  37. With ANSI C, the form of the fopen mode has become much better standardized.
  38. The ANSI standard actually requires support for the '+' and 'b' fopen modes,
  39. so the code given above for the MACINTOSH could be used for all platforms.
  40. Once this is done, the only platform specific tweaking would be if you
  41. wanted to include a 't' for translated modes, e.g.
  42.  
  43. #if MSDOS || ( OS2 && !CSET2 )
  44.       if ((status & Fs_Untrans) == 0) strcat(mode,"t");
  45. endif     /* MSDOS || ( OS2 && !CSET2 ) */
  46.  
  47. Even this is not absolutely necessary, since fopen defaults to opening in
  48. text mode if the mode parameter does not include 'b'. Since Icon now
  49. requires an ANSI compiler, we could simply retire the [@fsys.05] section and
  50. replace it with the code for adding 'b' and '+' to mode.
  51.  
  52. ----- Original Message -----
  53. From: Richard A. O'Keefe <ok@hermes.otago.ac.nz>
  54. To: <icon-group@optima.CS.Arizona.EDU>; Lhota, Frank
  55. <lhotaf@lexma.meitech.com>; <memphis@macconnect.com>
  56. Sent: Tuesday, September 07, 1999 9:13 PM
  57. Subject: Re: Is open(..,"b") broken in MPW Icon 9.0?
  58.  
  59.  
  60. > #if MACINTOSH
  61. >       if ((status & (Fs_Read|Fs_Write)) == (Fs_Read|Fs_Write)) {
  62. >          mode[1] = '+';
  63. >          mode[2] = ((status & Fs_Untrans) != 0) ? 'b' : 't';
  64. >          }
  65. >       else mode[1] = ((status & Fs_Untrans) != 0) ? 'b' : 't';
  66. > #endif     /* MACINTOSH */
  67. >
  68. > 't' is a Windows-ism that has no defined effect in the C standard,
  69. > nor is it defined in any of the Macintosh C compilers I have ready
  70. > access to.  The modes supported are
  71. >
  72. > (r|w|a)(+[b]|b[+])
  73. >
  74. > Some Macintosh C compilers define '\n' to be CR, which is the only
  75. > really sensible choice, and with those compilers the 'b' option is
  76. > superfluous.  Some define '\n' to be LF, which is really really
  77. > silly, and those compilers translate between external CR and internal
  78. > LF.  So the 'b' option is not superfluous with those compilers.
  79.  
  80.